<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        html{background: red;}
    </style>
</head>
<body>
    这是测试首页<br>
    <button id="btn">发起跨域请求</button>
</body>
<script>
    const btn = document.getElementById("btn")

    btn.onclick = function(){

        const url = "/wanandroid/banner/json";

        const xhr = new XMLHttpRequest();
        xhr.open("get",url);
        xhr.send()
        xhr.onload = function(){
            if(xhr.status === 200){
                console.log(xhr.responseText);
            }
        }

    }
</script>
</html>